package com.job.Gai_Yian.Homework0715;

import sun.security.util.Length;

/**
 * @author Gai_Yian
 * @version 1.0
 * @since 2022-07-15 16:16:12
 */
public class StringEx01 {
    public static void main(String[] args) {
        int max=1;
        char c=' ';
        int count=1;
        String str="aa111nvBBBB49999www";
        for (int i=0;i<str.length()-1;i++){
            if (str.charAt(i)==str.charAt(i+1)){
                count++;
            }else{
                if (max<count){
                    max=count;
                    c=str.charAt(str.length()-1);
                }
                count=1;
            }
        }
        System.out.println(c+"~"+count);
    }
}
